package org.easyentity.groovy

import org.junit.Test
import org.easyorm.groovy.SimpleEntityManager
import org.easyorm.groovy.EntityManager

public class SimpleEntityManagerTest {

	@Test
	void insert_an_entity_success() {
		def expected = "insert into ABean (dateField, intField, stringField) values" +
				" (\'2011-11-11 12:00:00\', 10, \'string\')"
		assert expected.equals(new SimpleEntityManager().buildInsertStmt(new ABean()))
	}

	@Test
	void test() {
		EntityManager entityManager = new SimpleEntityManager("jdbc:mysql://localhost/my_db",
				"root", "", "com.mysql.jdbc.Driver")
		entityManager.create(new ABean())

		println entityManager.find(new ABean())
	}
}
